-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0005 - Literal syntax for collections #22
base: main
Are you sure you want to change the base?
Conversation
We (Christophe, Pablo and me) find that the naming In the future we will have to explain this selector in books and it would be nice to have an explicit name easy to explain. Maybe |
It is ok for me. |
Suggestion: the ‘motivation’ section in the proposal should perhaps better clarify the need for a syntax extension. At the moment it’s not so clear, at least to me, why it would not be sufficient to implement some binary selector, say Set*{1 . Set*{2 . 2} . 1}.
"=> a Set(a Set(2) 1)"
Bag*{1 . Bag*{2 . 2} . 1}.
"=> a Bag(1 1 a Bag(2 2))"
Dictionary*{ #a -> 33 . #b -> 44 }.
"=> a Dictionary(#a->33 #b->44 )" |
Wow, that is a great idea ! I love it. Not sure about which binary selector would be best, but that is a secondary discussion. |
I like it (as Sven, I would probably not use * but another selector, but that's another discussion :) ). |
if |
So to me a message does not work. In particular because we do not have macros in Pharo. because in that case *{ should not be a message but a kind of macro. and in lisp they have a way to know the end of an expression. |
Well, And no, it is not a macro, I think we all agree on that. In any case, it is a thought experiment. I think we all want no more syntax than strictly necessary. |
Just to avoid any confusion, here’s the implementation of Collection class >> * anArray [
^ self newFromArray: anArray
] |
Ah ok I see.
|
So can you propose a PR? and we will close my proposal. |
Wasn't one reason for changing the parser to avoid intermediate collections? |
I would have like but this is the way {} is implemented. |
I created the following pull request for it: pharo-project/pharo#15316 |
No description provided.